<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><s:text name="context.title"/></title>
<%@ include file="/common/meta.jsp"%>
<script type="text/javascript">
$(document).ready(function(){
	$("#main").validate();
	$("#collegeTeam").click(function(){
		if(this.value != ""){
			$.post("select-team!getTeam?d="+new Date(),{id:this.value},function(data){
				if(data){
					cleanup("teamTeam");
					$.each(data,function(inx,obj){
						if(obj.type == "3"){
							$("#teamTeam").append("<option value='"+obj.id+"'>"+obj.name+"</option>");
						}
						});	
				}else{
					alert("操作失败！");
				}
				},"json");
		}
		});

	$("#schoolStudent").click(function(){
		if(this.value != ""){
			$.post("select-team!descipline?d="+new Date(),{id:this.value},function(data){
				if(data){
					cleanup("zhuanyue");
					$.each(data,function(inx,obj){
						$("#zhuanyue").append("<option value='"+obj.id+"'>"+obj.name+"</option>");
						});	
				}else{
					alert("操作失败！");
				}
				},"json");
		}
		});
	
});
function cleanup(id){
	$("#" + id).empty();	
}

function checkAll(obj){
	if(obj.checked){
		$(".chx").attr("checked","checked");
	}else{
		$(".chx").removeAttr("checked");
	}
}
</script>
</head>
<body>
<form action="select-team" method="post" id="main">
<br/>
<p align="center"><s:actionmessage theme="mytheme" cssClass="actionMessage"/></p>
<h1 class="title01"><img src="${ctx}/images/02_15.gif" width="45" height="42" class="fl"/>分配学生到团队</h1>
<input type="hidden" id="tid" value="${thesis.id }"/>
<fieldset class="fs_ys" style="width: 600px">
<legend>团队</legend>
	<p>
		学院：
			<select name="cid" class="required" id="collegeTeam">
				<option value="">请选择</option>
				<s:iterator value="colleges" var="v">
					<option value="${v.id }" <s:if test="#v.id == cid">selected="selected"</s:if>>${v.collegeName }</option>
				</s:iterator>
			</select>
		&nbsp; &nbsp;&nbsp;   团队:
		<select name="tid" class="required" id="teamTeam">
			<option value="">请选择</option>
			<s:iterator value="#request.teamss" var="v">
				<s:if test="#v.type ==3L">
				<option value="${v.id }" <s:if test="#v.id == tid">selected="selected"</s:if>>${v.groupName }</option>
				</s:if>
			</s:iterator>
		</select>
	</p>
</fieldset>
<br/>
<fieldset class="fs_ys" style="width: 600px">
<legend>学生</legend>
<table>
	<tr>
		<th nowrap>学院名称:</th>
		<td>
			<select class="required" id="schoolStudent">
				<option value="">请选择</option>
				<s:iterator value="colleges" var="v">
					<option value="${v.id }" <s:if test="#v.id == cid">selected="selected"</s:if>>${v.collegeName }</option>
				</s:iterator>
			</select>
		&nbsp;</td>
		<th nowrap>专业:</th>
		<td>
			<select name="did" id="zhuanyue" class="required">
				<option value="">请选择</option>
				<s:iterator value="#request.disciplines" var="v">
					<option value="${v.id }" <s:if test="#v.id==did">selected="selected"</s:if>>${v.disciplineName }</option>
				</s:iterator>
			</select>
		&nbsp;</td>
		<th>
		<tc:timeControler authName="答 辩">
			<input type="submit" name="method:query" value="查询"/>
		</tc:timeControler>
		</th>
	</tr>
</table>
<br />
<s:if test="stduents != null &&stduents.size() !=0">
<table id="contentTable1" class="table_ys tableColor table_ys_input">
	<tr>
		<th nowrap="nowrap" colspan="">序号</th>
		<th nowrap="nowrap"><input type="checkbox" onclick="checkAll(this)"/></th>
		<th nowrap="nowrap">所属院系</th>
		<th nowrap="nowrap">学号</th>
		<th nowrap="nowrap">姓名</th>
		<th nowrap="nowrap">班级</th>
		<th nowrap="nowrap">所属团队</th>
		<th nowrap="nowrap">选择的题目</th>
	</tr>
	<s:iterator value="stduents" var="v" status="st">
	<tr>
		<td>${st.index + 1 }&nbsp;</td>
		<td><input type="checkbox" name="checkIds" value="${v.id }" class="chx"/>&nbsp;</td>
		<td>${v.discipline.college.collegeName }&nbsp;</td>
		<td>${v.studentNo }&nbsp;</td>
		<td>${v.studentName }&nbsp;</td>
		<td>${v.classes }&nbsp;</td>
		<td>${v.group.groupName }&nbsp;</td>
		<td>${v.thesis.titile }&nbsp;</td>
	</tr>
	</s:iterator>
	<tr>
		<td colspan="8">
			<tc:timeControler authName="答 辩">
			<center><input type="submit" value="提交选择" name="method:confirmStudent" onclick="return confirm('确认提交？')"/></center>
			</tc:timeControler>
		&nbsp;</td>
	</tr>
</table>
</s:if>
</fieldset>
</form>
</body>

</html>